configure cli script timeout

configure cli script timeout timeout

Description

Configures the maximum time a script can run.

Syntax Description

timeout Defines the timeout period in seconds.

Default

Regular script: no time limit default.xsf: 500 seconds autoexec.xsf: 500 seconds

Usage Guidelines

This command configures the maximum run time for all scripts, including default.xsf and autoexec.xsf, which are described in Software Upgrade and Boot Options section in the ExtremeXOS 22.6 User Guide. If no timeout period is configured, regular scripts do not timeout, and the default.xsf and autoexec.xsf scripts time out after 500 seconds.

If a script does not finish running in the configured time, command execution stops and an error message is logged. If the timer expires while a command is executing, the command execution continues and all following commands are not executed.

If the timer command is executed inside a script, the timer is reset. If the command is issued more than once inside a script the last timer command executed resets the timer. The timer is valid only for that session. The use of nested scripts does not extend the execution period. When the parent script reaches the timeout value, the parent script and all nested scripts terminate.

To configure a different timeout value for autoexec.xsf or default.xsf, the configure cli script timeout command should be the first command in the script.

When a script timeout value is configured, the following variables are created: $CLI.SCRIPT_TIMEOUT and $CLI.SCRIPT_TIME_REMAINING. If no timeout value is configured for a session, the variables are not created.

You can use the $CLI.SCRIPT_TIMEOUT variable to adjust the timeout value. The $CLI.SCRIPT_TIME_REMAINING variable returns the time remaining. When a timeout value is configured, the variable values are as follows:

  • If no script is running, both $CLI.SCRIPT_TIME_REMAINING and $CLI.SCRIPT_TIMEOUT show the configured timeout value.
  • If a script is aborted due to timeout, the $CLI.SCRIPT_TIME_REMANING variable returns the value0.
  • If a script finishes execution (before the timeout value is reached) the $CLI.SCRIPT_TIME_REMANING variable returns the remaining time.

Example

The following example configures the switch to terminate a script after 120 seconds:

configure cli script timeout 120

History

This command was first available in ExtremeXOS 12.4.

Platform Availability